package com.ninetaildemonfox.zdl.socialproject.mvp.ui.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.ViewGroup;
import com.jude.easyrecyclerview.adapter.BaseViewHolder;
import com.jude.easyrecyclerview.adapter.RecyclerArrayAdapter;
import com.ninetaildemonfox.zdl.socialproject.R;
import com.ninetaildemonfox.zdl.socialproject.mvp.ui.adapter.viewholder.RadioStationViewHolder;

import java.util.Map;

/**
 * 创建人： Nine tails fox
 * 创建时间： 2019/7/22
 * 功能描述： 电台界面item的绑定布局
 * 联系方式：1037438704@qq.com
 *
 * @author NineTailDemonFox
 */

public class RadioStationAdapter extends RecyclerArrayAdapter<Map<String, String>> {
    private LayoutInflater layoutInflater;
    private int adptype = 1;

    private int jubaoInt = 0 ;

    public RadioStationAdapter(Context context) {
        super(context);
        layoutInflater = LayoutInflater.from(context);
    }

    public void setJubaoInt(int jubaoInt) {
        this.jubaoInt = jubaoInt;
    }

    @Override
    public BaseViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) {
        RadioStationViewHolder radioStationViewHolder = new RadioStationViewHolder(layoutInflater.inflate(R.layout.list_radiostation_adp, parent, false));
        radioStationViewHolder.getType(adptype);
        radioStationViewHolder.setJubaoInt(jubaoInt);
        radioStationViewHolder.setmOnClick(new RadioStationViewHolder.ItemOnClick() {
            @Override
            public void onClick(int position, Map<String, String> data, int type) {
                if (itemOnClick != null) {
                    itemOnClick.onClick(position, data,type);
                }
            }
        });
        return radioStationViewHolder;
    }
    public interface ItemOnClick{
        void onClick(int position, Map<String,String> data,int type);
    }

    private ItemOnClick itemOnClick;

    public void setmOnClick(ItemOnClick mOnClick) {
        this.itemOnClick = mOnClick;
    }

    public void adpType(int adptype){
        this.adptype = adptype;
    }

}
